package com.jic.interaction.JDVOP.common.utils;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author bourne
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RestResult<T> implements Serializable {

    private String success;
    private String resultMessage;
    private String resultCode;
    private T result;

    public static<T> RestResult error(T result,String resultCode,String resultMessage) {
        return RestResult.builder()
                .success("false")
                .resultMessage(resultMessage)
                .resultCode(resultCode)
                .result(result)
                .build();
    }

    public static <T> RestResult<T> success(T result,String resultCode,String resultMessage) {
        return RestResult.<T>builder()
                .success("true")
                .resultMessage(resultMessage)
                .resultCode(resultCode)
                .result(result)
                .build();
    }

}
